package cn.wx.sqlSession.defaults;

import cn.wx.sqlSession.SqlSession;
import cn.wx.sqlSession.SqlSessionFactory;
import cn.wx.utils.XMLConfigBuilder;

import java.io.InputStream;

public class DefaultSqlSessionFactory implements SqlSessionFactory {

    private final InputStream config;
    public DefaultSqlSessionFactory(InputStream config) {
        this.config = config;
    }
    @Override
    public SqlSession openSqlSession() {
        DefaultSqlSession sqlSession = new DefaultSqlSession();
        XMLConfigBuilder.loadConfiguration(sqlSession, config);
        return sqlSession;
    }

    @Override
    public SqlSession openSqlSession(boolean commit) {
        return null;
    }
}
